<template>
	<view class="theme-item">
		<navigator :url="`/pages/classify/classlist/classlist?id=${item._id}&name=${item.name}`" class="box" v-if="!isMore">
			<image class="image" :src="item.picurl||'https://mp-0cb878b7-99ec-44ea-8246-12b123304b05.cdn.bspapp.com/xxmBizhi/20231010/1696902573130_5976.jpg'"  mode="aspectFill" ></image>
			<view class="mask">{{item.name}}</view>
			<div class="update">{{updateDate}}前更新</div>
		</navigator>
		<navigator url="/pages/classify/classify" open-type="reLaunch" class="box more" v-if="isMore">
			<image class="image" :src="item.picurl||'https://mp-0cb878b7-99ec-44ea-8246-12b123304b05.cdn.bspapp.com/xxmBizhi/20231010/1696902573130_5976.jpg'"  mode="aspectFill" ></image>
			<view class="mask">
				<uni-icons type="more" size="34" color="white"></uni-icons>
				<view>更多</view>
			</view>
		</navigator>
	</view>
</template>

<script setup>
import { formatTimestamp } from '@/utils/utils';

const props = defineProps({
	isMore:{
		type:Boolean,
		default:false
	},
	item:{
		type:Object,
		default:()=>({})
	}
})
const updateDate = computed(()=>{
	return formatTimestamp(props.item.updateTime)
})
</script>

<style lang="scss" scoped>
.theme-item {
	.box {
		border-radius: 10rpx;
		height: 340rpx;
		overflow: hidden;
		position: relative;
		.image {
			width: 100%;
			height: 100%;
		}
		.mask {
			position: absolute;
			bottom: 0;
			left: 0;
			width: 100%;
			height: 70rpx;
			background-color: rgba(0, 0, 0, .1);
			color: #fff;
			display: flex;
			align-items: center;
			justify-content: center;
			backdrop-filter: blur(20px);
			font-weight: 700;
		}
		&.more {
			.mask {
				height: 100%;
				flex-direction: column;
			}
		}
		.update {
			position: absolute;
			top: 0;
			left: 0;
			background-color: rgba(250, 129, 90, .7);
			color: white;
			font-size: 22rpx;
			padding: 10rpx 20rpx;
			backdrop-filter: blur(20px);
			border-radius: 0 0 22rpx 0;
			transform: scale(.8);
			transform-origin: top left;
		}
	}
}
</style>